﻿using ProjectDanmaku.Entity;
using ProjectDanmaku.Entity.SubLayer.EnemyBullet;
using UnityEditor;
using UnityEngine;

namespace Editor.ProjectDanmaku.Inspector
{
    public class EntityLayerMenu
    {
        [MenuItem("GameObject/Entity Layer", priority = 1)]
        public static void CreateEntityLayerMenu()
        {
            var go = Selection.activeObject as GameObject;
            if (go == null)
                return;
            
            var entityLayer = new GameObject("Entity Layer");
            entityLayer.transform.SetParent(go.transform);

            entityLayer.AddComponent<EntityLayer>();
            
            Undo.RecordObject(go, "Create Entity Layer");
            
            Selection.activeObject = entityLayer;
        }
        
        [MenuItem("GameObject/Simple Bullet Sub Layer", priority = 1)]
        public static void CreateSimpleBulletLayerMenu()
        {
            var go = Selection.activeObject as GameObject;
            if (go == null)
                return;
            
            var subLayer = new GameObject("Simple Bullet Sub Layer");
            subLayer.transform.SetParent(go.transform);

            subLayer.AddComponent<SimpleBulletSubLayer>();
            
            Undo.RecordObject(go, "Create Entity Layer");
            
            Selection.activeObject = subLayer;
        }
    }
    
}